package com.example.itcompanyinterview.object;

import org.json.JSONException;
import org.json.JSONObject;

import com.example.itcompanyinterview.tools.ApplicationDefination;
import com.example.itcompanyinterview.tools.CommonJsonParser;

public class AppCommonInfo {
	private int latestVersion;
	private String latestVersionUrl;
	
	public AppCommonInfo(String jsonObj) {
		JSONObject obj = CommonJsonParser.parseJsonObject(jsonObj);
		if(obj != null) {
			try {
				this.latestVersion = obj.getInt("clientVersion");
				this.latestVersionUrl = 
						ApplicationDefination.Host + obj.getString("clientApkFile");
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

	public int getLatestVersion() {
		return latestVersion;
	}

	public void setLatestVersion(int latestVersion) {
		this.latestVersion = latestVersion;
	}

	public String getLatestVersionUrl() {
		return latestVersionUrl;
	}

	public void setLatestVersionUrl(String latestVersionUrl) {
		this.latestVersionUrl = latestVersionUrl;
	}
	
	
}
